package com.example.utils;


import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;

public class CookieUtils {

    public static void setCookie(HttpServletResponse response, String name, String value, int maxAge) {
        Cookie cookie = new Cookie(name, value);
        cookie.setMaxAge(maxAge); // 30 days in seconds
        cookie.setPath("/"); // Cookie path
        response.addCookie(cookie);
    }
}
